Skip to content

Reset isSubmitting when validation or sync onSubmit throws - #4082

Open
webdevelopersrinu wants to merge 2 commits into
jaredpalmer:mainfrom
webdevelopersrinu:fix-stuck-issubmitting
Open

webdevelopersrinu wants to merge 2 commits into
jaredpalmer:mainfrom
webdevelopersrinu:fix-stuck-issubmitting

Conversation

@webdevelopersrinu

Copy link
Copy Markdown

When the validate function throws an error, isSubmitting and isValidating stay true forever, because the error path never resets them. So a submit button disabled on isSubmitting stays dead until page reload. Same when onSubmit throws synchronously. I added the missing cleanup in both error paths, the error is still re-thrown like before.

Added two tests, they fail without the fix and pass with it.

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

@webdevelopersrinu is attempting to deploy a commit to the Formik Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 45d0b34

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
formik Patch
formik-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci

codesandbox-ci Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Reset the isSubmitting state when validation or synchronous onSubmit throws an error.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant